package imaa.escola.instrumento.repository;

import imaa.escola.instrumento.datatransfer.PesquisaInstrumentoDto;
import imaa.escola.instrumento.domain.Instrumento;
import imaa.framework.persistence.CustomRepository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface InstrumentoRepository extends JpaRepository<Instrumento, Long>, CustomRepository<Instrumento, PesquisaInstrumentoDto> {

	@Query("SELECT a FROM Instrumento a WHERE LOWER(a.nome) LIKE CONCAT('%', LOWER(:nome), '%')")
    public List<Instrumento> findByName(@Param("nome") String nome);
}
